package com.dyypdadmin.service.impl;

import com.dyypdadmin.dao.UsersDao;
import com.dyypdadmin.pojo.Users;
import com.dyypdadmin.service.UsersService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class UsersServiceImpl implements UsersService {
    @Autowired
    private UsersDao usersDao;

    @Override
    public int addUser(String username, String phone, String password, String address) {
        return usersDao.addUser(username, phone, password, address);
    }

    @Override
    public Users getUserByUsernameAndPassword(String username, String password) {
        return usersDao.getUserByUsernameAndPassword(username, password);
    }

    @Override
    public List<Users> getAllUser() {
        return usersDao.selectList(null);
    }

    @Override
    public int updateUserInfo(Users users) {
        return usersDao.updateUserInfo(users);
    }

    @Override
    public List<Users> getUserInfoByUsername(String username) {
        return usersDao.getUserInfoByUsername(username);
    }

    @Override
    public int getUserCounts() {
        return usersDao.getUserCounts();
    }

    @Override
    public int updatePwdByUserId(Users users) {
        return usersDao.updatePwdByUserId(users);
    }
}
